<template>
  <div class="photoinfo">
    <h3>{{arr.title}}</h3>
    <p class="time">
      <span>发表时间：{{arr.add_time | myFilter}}</span>
      <span>点击{{arr.click}}次</span>
    </p>
    <hr>
    <!-- 缩略图 -->
    <div class="slt">
        <vue-preview :slides="slide1"></vue-preview>
    </div>

    <!-- <img
      class="preview-img"
      v-for="(item,index) in list"
      :key="index"
      @click="$preview.open(index,list)"
      :src="item.src"
      height="100"
     
    > -->
    <!-- 发表评论 -->
    <div class="content" v-html="arr.content"></div>

    <!-- 评论子组件 -->
    <coment :id="id"></coment>
  </div>
</template>

<script>
import coment from '../subcomponents/coment.vue'
import { Toast } from "mint-ui";
export default {
  data() {
    return {
      id: this.$route.params.id,
      arr:[],
      slide1: [   //缩略图
          {
            src: 'https://farm6.staticflickr.com/5591/15008867125_68a8ed88cc_b.jpg',   //缩略图的大图片
            msrc: 'https://farm6.staticflickr.com/5591/15008867125_68a8ed88cc_m.jpg',   //缩略图的小图片
            alt: 'picture1',
            title: 'Image Caption 1',
            w: 600,
            h: 400
          },
          {
            src: 'https://farm4.staticflickr.com/3902/14985871946_86abb8c56f_b.jpg',
            msrc: 'https://farm4.staticflickr.com/3902/14985871946_86abb8c56f_m.jpg',
            alt: 'picture2',
            title: 'Image Caption 2',
            w: 1200,
            h: 900
          },
          {
            src: 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3850140712,4270095677&fm=27&gp=0.jpg',
            msrc: 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3850140712,4270095677&fm=27&gp=0.jpg',
            alt: 'picture2',
            title: 'Image Caption 2',
            w: 1200,
            h: 900
          }
        ]
    };
  },
  methods: {
      getphotoinfo(){
          this.$axios.get('/api/getnew/'+this.id).then(result=>{
              this.arr=result.data.message[0]
              console.log(this.arr)
          })
      },
      getsuolt(){   //缩略图
          this.$axios.get('/api/getthumimages/'+this.id).then(result=>{
              if(result.data.status===0){
               Toast('后台图片地址地址全部tmd失效')
              }
              console.log(result)
          })
      }
  },
  created () {
      this.getphotoinfo();
      this.getsuolt()
  },
  components: {
      coment
  }
};
</script>

<style scoped lang="scss">
.photoinfo {
  padding: 5px;
  h3 {
    font-size: 15px;
    color: blue;
    margin: 15px 0;
    text-align: center;
  }
  .time {
    display: flex;
    justify-content: space-between;
  }
  .content {
    font-size: 13px;
    line-height: 30px;
  }
}
.slt{
      vue-preview{
          margin: 10px;
          width: 100px;
          height: 80px;
      }
  }
</style>
